﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace Reporting
{
    public partial class frmAddReport : XtraForm
    {
        public frmAddReport()
        {
            InitializeComponent();
        }

        private void frmAddReport_Load(object sender, EventArgs e)
        {
            Database db = new Database();
            comboBoxEdit1.Properties.Items.AddRange(db.GetViews());
            if (comboBoxEdit1.Properties.Items.Count > 0)
                comboBoxEdit1.SelectedIndex = 0;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            frmMain main = this.Owner as frmMain;
            main.AddReport(textEdit1.Text, comboBoxEdit1.Text);
            main.WriteFile(textEdit1.Text, comboBoxEdit1.Text);
            this.Close();
        }
    }
}
